package cn.com.scitc.soft2101.mapper;

import cn.com.scitc.soft2101.model.Paid;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface PaidMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table paid
     *
     * @mbg.generated Wed May 10 17:10:03 CST 2023
     */
    @Delete({
        "delete from paid",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table paid
     *
     * @mbg.generated Wed May 10 17:10:03 CST 2023
     */
    @Insert({
        "insert into paid (paidType, paidName, ",
        "paidDate, amountPaid, ",
        "remark)",
        "values (#{paidType,jdbcType=VARCHAR}, #{paidName,jdbcType=VARCHAR}, ",
        "#{paidDate,jdbcType=TIMESTAMP}, #{amountPaid,jdbcType=DECIMAL}, ",
        "#{remark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Paid row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table paid
     *
     * @mbg.generated Wed May 10 17:10:03 CST 2023
     */
    @Select({
        "select",
        "id, paidType, paidName, paidDate, amountPaid, remark",
        "from paid",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="paidType", property="paidType", jdbcType=JdbcType.VARCHAR),
        @Result(column="paidName", property="paidName", jdbcType=JdbcType.VARCHAR),
        @Result(column="paidDate", property="paidDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="amountPaid", property="amountPaid", jdbcType=JdbcType.DECIMAL),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
    })
    Paid selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table paid
     *
     * @mbg.generated Wed May 10 17:10:03 CST 2023
     */
    @Select({
        "select",
        "id, paidType, paidName, paidDate, amountPaid, remark",
        "from paid"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="paidType", property="paidType", jdbcType=JdbcType.VARCHAR),
        @Result(column="paidName", property="paidName", jdbcType=JdbcType.VARCHAR),
        @Result(column="paidDate", property="paidDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="amountPaid", property="amountPaid", jdbcType=JdbcType.DECIMAL),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
    })
    List<Paid> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table paid
     *
     * @mbg.generated Wed May 10 17:10:03 CST 2023
     */
    @Update({
        "update paid",
        "set paidType = #{paidType,jdbcType=VARCHAR},",
          "paidName = #{paidName,jdbcType=VARCHAR},",
          "paidDate = #{paidDate,jdbcType=TIMESTAMP},",
          "amountPaid = #{amountPaid,jdbcType=DECIMAL},",
          "remark = #{remark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Paid row);
}